package com.mbf.crm;

import javax.servlet.ServletContext;

import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.multipart.support.MultipartFilter;

/**
 * 如果要打成WAR包，放到tomcat之类的web服务器上运行，必须要有此类
 * @author 张劲松
 *
 */
public class ServletInitializer extends SpringBootServletInitializer {

	@Override
	protected SpringApplicationBuilder configure(
			SpringApplicationBuilder application) {
		logger.info("SpringApplicationBuilder...");
		return application.sources(Study2Application.class);
	}
	
	@Override
	protected WebApplicationContext createRootApplicationContext(
			ServletContext servletContext) {
		servletContext.addFilter("multipartFilter", new MultipartFilter());
		return super.createRootApplicationContext(servletContext);
	}
	
}
